'''
Created on 2009-7-10

@author: yunxie
'''
from datetime import date

def generateBaselineTag(d):
    return "{y}{m}{d}".format(y=d.year,m=d.month,d=d.day)
class Session:
    _repo = ""
    def __init__(self,respo = 'svn://127.0.0.1/',tags_folder = "tags",trunk_folder="trunk",branch_folder = "branchs",user = "xy",passwd = "123"):
        self._repo = repo
        self._tags_path = repo + tags_folder
        self._trunk_folder = repo + trunk_folder
        self._branch_folder = repo + branch_folder
        self._passwd = passwd
        self._user = user
    #list baseline
    #
    def listTags(self):
        pass
    def createTags(self, comment):
        d = date.today()
        tags = generateBaselineTag(d)
        if comment == None or comment.strip() == "":
            comment = self._user + " create baseline in " + d
        print " ".join(["svn copy ", self._trunk_folder, self._tags_path + datetags,
                       "--username " + self._user, "--password " + self._passwd,
                       " -m" + comment])
        
'''
    Chinese comments can not work
    ut test function
'''

def ut_test():
    #test generateBaselineTag
    print generateBaselineTag(date.today())
if __name__ == "__main__":
    ut_test()
    
    